{extend name="platform/base" /} {block name="resources"/}
{/block} {block name="main"}
<div class="row padder-v">
	<div class="col-sm-7"></div>
	<div class="col-sm-2">
		<div class="input-group">
			<input id="assistant_nick_name" class="input-sm form-control"
				type="text" value="" placeholder="请输入推荐人名称">
		</div>
	</div>

	<div class="col-sm-2">
		<div class="input-group">
			<input id="apply_assistant_nick_name" class="input-sm form-control"
				type="text" value="" placeholder="请输入被推荐人名称">
		</div>
	</div>
	<div class="col-sm-1">
		<div class="input-group">
			<span class="input-group-btn">
				<button class="btn btn-sm btn-default" type="button"
					onclick="LoadingInfo(1)">搜索</button>
			</span>
		</div>
	</div>
</div>
<section class="panel panel-default">
	<div class="table-responsive">
		<table class="table table-striped b-light text-sm">
			<thead>
				<tr>
					<th><label style="margin-left: 5px;"> <input
							type="checkbox"></label></th>
					<th>招商员</th>
					<th>被招商员</th>
					<th>推荐等级</th>
					<th>申请金额</th>
					<th>佣金比率</th>
					<th>佣金金额</th>
					<th>时间</th>
					<!-- 						<th>分销佣金</th> -->
					<!-- 						<th>股东分红</th> -->
					<!-- 						<th>股东全球分红</th> -->
					<!-- 						<th>区域代理佣金</th> -->
				</tr>
			</thead>
			<tbody id="list">
				<tr></tr>
			</tbody>
		</table>
	</div>
	{include file="platform/page" /}
</section>

<!-- 修改用户上级（Modal）结束 -->
{/block} {block name="script"}
<script type="text/javascript">	
	//查询
	$(function(){
	LoadingInfo(1);
});
	function LoadingInfo(pageIndex) {
		var assistant_nick_name = $("#assistant_nick_name").val();
		var apply_assistant_nick_name = $("#apply_assistant_nick_name").val();
		$.ajax({
			type : "post",
			url : "{:__URL('PLATFORM_MAIN/Assistant/recommendcommission')}",
			async : true,
			data : {
				"pageIndex" : pageIndex,
				"assistant_nick_name":assistant_nick_name,
				"apply_assistant_nick_name":apply_assistant_nick_name
			},
			success : function(data) {
				var html = '';
				$("#total_count_num").text(data["total_count"]);
				$("#page_count_num").text(data["page_count"]);
				$("#page_count").val(data["page_count"]);
				$("#pageNumber a").remove();
				if (data["data"].length > 0) {
					for (var i = 0; i < data["data"].length; i++) {
						html += '<tr>';	
						html += '<td><div class="cell"><label ><input name="sub" type="checkbox" value="'+ data["data"][i]["id"] +'" ></label></div></td>';
						html += '<td>' + data["data"][i]["assistant_nick_name"] + '</td>';
						html += '<td>' + data["data"][i]["apply_assistant_nick_name"] + '</td>';
						
						if(data["data"][i]['level']==0){
							html += '<td>直接推广</td>';
						}else if(data["data"][i]['level']==1){
							html += '<td>上级</td>';
						}else if(data["data"][i]['level']==2){
							html += '<td>上上级</td>';
						}
						html += '<td>' + data["data"][i]["apply_money"] + '</td>';
						html += '<td>' + data["data"][i]["comission_rate"] + '%</td>';
						html += '<td>' + data["data"][i]["commission"] + '</td>';
						html += '<td>' + data["data"][i]["create_time"] + '</td>';
					//	html += '<td>' + parseFloat(data["data"][i]["commission_partner_team"]).toFixed(2) + '</td>';
					//	html += '<td>' + parseFloat(data["data"][i]["commission_promoter_team"]).toFixed(2) + '</td>';
					//	html += '<td>' + parseFloat(data["data"][i]["commission_channelagent"]).toFixed(2) + '</td>';						
						html += '</tr>';
					}
				} else {
					html += '<tr align="center"><th colspan="11">暂无符合条件的数据记录</th></tr>';
				}
				
				$("#list").html(html);
					var totalpage = $("#page_count").val();
			if (totalpage == 1) {
				changeClass("all");
			}
			var $html = pagenumShow(jumpNumber,totalpage,{$pageshow})
			$("#pageNumber").append($html);
			}
		});
	}
	
	//全选
	function CheckAll(event){
		var checked = event.checked;
		$(".style0list tbody input[type = 'checkbox']").prop("checked",checked);
	}
	

</script>
{/block}
